#***********************************************************
# libmorpho
#***********************************************************
# Creation :     01/08/2005
# Modification : 01/05/2007
#***********************************************************
# (c) Christophe Clienti
#***********************************************************

include ../../Makefile.include 

SRCS            = $(shell ls *.c)
OBJS            = $(SRCS:.c=.o)	
HEADER          = $(shell ls *.h)

CFLAGS 		= -fPIC -g -Wall $(COMPILER_OPTIM)

INCDEP 		= -I. -I../../include
LIBDIR          += -L../../lib -L.
LDFLAGS         += -l$(LIBNAME_BASE)

EXE 		= testarith



.SUFFIXES: .c .o


all : $(EXE)

test : $(EXE)
	@LD_LIBRARY_PATH=../../lib:$(LD_LIBRARY_PATH) ./$(EXE)

test_valgrind : $(EXE)
	@LD_LIBRARY_PATH=../../lib:$(LD_LIBRARY_PATH) valgrind  --leak-check=full --show-reachable=yes --log-file-exactly=./$(EXE).valgrind.log ./$(EXE)
	@cat $(EXE).valgrind.log | grep "SUMMARY"

test_gdb : $(EXE)
	@LD_LIBRARY_PATH=../../lib:$(LD_LIBRARY_PATH) gdb ./$(EXE)

$(EXE):  macro.o $(OBJS)
	$(CC) $(LDFLAGS) $(LIBDIR) -o $(EXE) $(OBJS) macro.o

.c.o :
	$(CC) $(CFLAGS) $(INCDIR) $(INCDEP) -c $< 

macro.o: ../macro.c
	$(CC) $(CFLAGS) $(INCDIR) $(INCDEP) -c ../macro.c -o macro.o

clean :
	rm -f *.o *~ *\# *.pgm *valgrind.log.* $(EXE)